﻿using Microsoft.Web.WebView2.Wpf;
using ShanNiang.Mvvm.ViewModels;
using ShanNiang.Service.Attributes;
using ShanNiang.Service.Constants;
using System.Runtime.Versioning;
using System.Windows.Controls;
using System.Windows.Input;

namespace ShanNiang.Packing.UserControls
{
    /// <summary>
    /// PackingHistoryControl.xaml 的交互逻辑
    /// </summary>
    [MenuControl(CommonData.MENU_BOXHISTORY, "装箱记录", 3, CommonData.MENU_ICON_BOXHISTORY)]
    [SupportedOSPlatform("windows")]
    public partial class PackBoxHistoryControl : UserControl
    {
        public PackBoxHistoryControl(PackBoxHistoryViewModel packingHistoryViewModel)
        {
            InitializeComponent();
            DataContext = packingHistoryViewModel;
             //webView.EnsureCoreWebView2Async(environment: null).GetAwaiter().GetResult();
        }

        private void Grid_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            e.Handled = true; // 取消回车键的默认行为
        }

        private void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            e.Handled = true;
        }


        //private async  void WebView_Initialized(object sender, Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs e)
        //{
        //    //var webView = sender as WebView2;
        //    if (webView != null)
        //        await webView.EnsureCoreWebView2Async(environment: null);
        //}
    }
}
